<script setup>
import { onMounted } from 'vue'
import { getBannerAPI } from '@/apis/home'
import { ref } from 'vue'
const banner = ref([])

const getBanner=async ()=>{ 

  const res=await getBannerAPI()
  banner.value=res.result
  console.log(res.result)
}
onMounted(()=>{
  getBanner()
})
let i=ref(0)
setInterval(()=>{
  if(i.value<banner.value.length-1){
    i.value++
  }else{
    i.value=0
  }
 },1000)

</script>
 

<template>
  <div class="home-banner">
  <img :src="banner[i]?.imgUrl" alt="">

  </div>
</template>

<style scoped>
.home-banner {
  height: 100%;
  width: 100%;
  background-color: blue;


}
</style>